<?php

use yii\db\Migration;

class m160510_030714_updateTable_doctor extends Migration
{
    const TBL_NAME = '{{%doctor}}';
    public function up()
    {
        $sql = "ALTER TABLE ".self::TBL_NAME."
            ADD COLUMN `create_time`  datetime NOT NULL AFTER `follow_numbers`,
            ADD COLUMN `update_time`  timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `create_time`;";
        $this->execute($sql);
    }

    public function down()
    {
        echo "m160510_030714_updateTable_doctor cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
